package com.bookcity.front.webfront.vo;

import com.bookcity.front.webfront.domain.Member;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.Collection;

/**
 * @author oldliu
 * @since 1.0
 */
public class MemberInfo implements Serializable, UserDetails {
    private Member mem;
private Collection<? extends GrantedAuthority>  authorities;
    public MemberInfo(Member m){
        this.mem=m;
    }
    public MemberInfo(Member m,Collection<? extends GrantedAuthority> c){
        this.mem=m;
        this.authorities=c;
    }
    public Member getMem() {
        return mem;
    }

    public void setMem(Member mem) {
        this.mem = mem;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        new Exception(">>>>>>>>>>>").printStackTrace();
        return this.authorities;
    }

    @Override
    public String getPassword() {
        return null;
    }

    @Override
    public String getUsername() {
        return mem.getAccountname();
    }

    @Override
    public boolean isAccountNonExpired() {
        return false;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
